Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add connections to notebook spawner page #3311

Merged

Conversation

emilys314
Copy link
Contributor

@emilys314 emilys314 commented Oct 8, 2024

Closes https://issues.redhat.com/browse/RHOAIENG-13141

https://www.figma.com/design/97akqulXiGIGtvxkdPLjMm/Data-connections-enhancement?node-id=1135-199631&node-type=canvas&t=L8KlrRwsSgc6f4pF-0

Description

Replaces data connections in the notebook spawner page.

  • If connection types is enable with the feature flag, the spawner page will show the connections form section instead of the old data connections
  • 2 main actions:
    • Attach existing connection
    • Create new connection
  • table of attached connections
    • backwards compatible with data connections, they should show up as the s3 type.
    • shows warning alert if connections with the same env vars exist

Screenshots:

Before

image

Table form section Empty state:

image
With 2 connections:

image
Conflicts env vars:

image
notebook UPDATED_NAME being propagated in from the postgres connection type

image

Modals

image

image

image

How Has This Been Tested?

  1. Set disableConnectionTypes dev flag to false
  2. Have at least an s3 connection type setup from the admin page (or wait until we have OOTB types)
  3. Go to a DS project and go to the workbenches
  • "Create workbench" to create a new notebook
  • or "Edit" and existing one to see that version
  1. Open a notebook console and you can run env to look for the env variables from multiple connections

A couple flows for testing (but there are a lot more):

  • Create connections ahead of time on the project's "Connections" details tab (or data connections) so they show up in the "attach existing connections"
  • Create a new connection from the notebook spawner "Create connection" button"
  • Edit an existing notebook with an s3 connection to see those in the table
  • In the notebook spawner, with an existing connection, click the kebab to detach
  • In the notebook spawner, with an existing connection, click the kebab to edit and save

Test Impact

Jest tests added for the connections form sub section.

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress This PR is in WIP state label Oct 8, 2024
Copy link
Contributor

openshift-ci bot commented Oct 8, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 80.93220% with 45 lines in your changes missing coverage. Please review.

Project coverage is 84.81%. Comparing base (6ec1b1b) to head (d5e9295).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...ens/spawner/connections/ConnectionsFormSection.tsx 81.33% 14 Missing ⚠️
...eens/spawner/connections/DetachConnectionModal.tsx 7.14% 13 Missing ⚠️
...ages/projects/screens/spawner/connections/utils.ts 47.82% 12 Missing ⚠️
...ens/spawner/connections/SelectConnectionsModal.tsx 92.10% 3 Missing ⚠️
.../src/pages/projects/notebook/useNotebooksStates.ts 85.71% 1 Missing ⚠️
...c/pages/projects/screens/spawner/SpawnerFooter.tsx 88.88% 1 Missing ⚠️
...src/pages/projects/screens/spawner/SpawnerPage.tsx 90.90% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3311      +/-   ##
==========================================
+ Coverage   84.79%   84.81%   +0.02%     
==========================================
  Files        1315     1326      +11     
  Lines       29491    29650     +159     
  Branches     8056     8100      +44     
==========================================
+ Hits        25006    25147     +141     
- Misses       4485     4503      +18     
Files with missing lines Coverage Δ
frontend/src/components/MultiSelection.tsx 77.14% <100.00%> (ø)
.../src/components/table/TableRowTitleDescription.tsx 100.00% <100.00%> (ø)
frontend/src/concepts/connectionTypes/utils.ts 93.27% <100.00%> (+0.55%) ⬆️
...ts/screens/detail/connections/ConnectionsTable.tsx 100.00% <100.00%> (ø)
...screens/detail/connections/ConnectionsTableRow.tsx 96.15% <100.00%> (ø)
...ns/spawner/connections/DuplicateEnvVarsWarning.tsx 100.00% <100.00%> (ø)
...ontend/src/pages/projects/screens/spawner/const.ts 100.00% <ø> (ø)
...r/environmentVariables/useNotebookEnvVariables.tsx 84.84% <100.00%> (-0.87%) ⬇️
...ontend/src/pages/projects/screens/spawner/types.ts 100.00% <100.00%> (ø)
.../src/pages/projects/notebook/useNotebooksStates.ts 90.00% <85.71%> (-10.00%) ⬇️
... and 6 more

... and 51 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ec1b1b...d5e9295. Read the comment docs.

@emilys314 emilys314 force-pushed the add-connections-to-workbench branch 3 times, most recently from 83c4a81 to fa34d84 Compare October 8, 2024 20:49
@emilys314 emilys314 changed the title notebook connection Add connections to notebook spawner page Oct 8, 2024
@emilys314 emilys314 force-pushed the add-connections-to-workbench branch 2 times, most recently from a3bb625 to cc49fd6 Compare October 9, 2024 14:18
@emilys314 emilys314 marked this pull request as ready for review October 9, 2024 14:19
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress This PR is in WIP state label Oct 9, 2024
@emilys314
Copy link
Contributor Author

@simrandhaliw

@emilys314 emilys314 force-pushed the add-connections-to-workbench branch 4 times, most recently from 0069d14 to 9bf71af Compare October 14, 2024 14:04
}) => {
const [connectionTypes] = useWatchConnectionTypes();

const [initialNumberConnections] = React.useState(selectedConnections.length);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be stored in a ref

Suggested change
const [initialNumberConnections] = React.useState(selectedConnections.length);
const initialNumberConnectionsRef = React.useRef(selectedConnections.length);

Comment on lines 41 to 42
a.metadata.annotations['opendatahub.io/connection-type'].localeCompare(
b.metadata.annotations['opendatahub.io/connection-type'],
Copy link
Contributor

@christianvogt christianvogt Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Display names can differ from their k8s resource name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch. Although I think this is happening in the project details connection tab as well. Should i fix that in this PR or a separate one?

<FlexItem>
<Button
data-testid="attach-existing-connection-button"
aria-describedby="no-connections-tooltip"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
aria-describedby="no-connections-tooltip"
aria-describedby={unselectedConnections.length === ? 'no-connections-tooltip' : undefined}

@openshift-ci openshift-ci bot removed the lgtm label Oct 16, 2024
@christianvogt
Copy link
Contributor

/lgtm
/approve

Copy link
Contributor

openshift-ci bot commented Oct 16, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt, jeff-phillips-18

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit cdc5b4c into opendatahub-io:main Oct 16, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants